import { memo } from "react"
import CommentItem from "./CommentItem"

const CommentList = (props)=>{
    const {comments,currentUser,slug} = props
   
    return(
        <div>
            {
                comments&&comments.map((comment)=>{
                    return(
                        <CommentItem key={comment.id} comment={comment} currentUser={currentUser} slug={slug}/>
                    )
                })
            }
        </div>
    )
}

export default memo(CommentList)